package tech.lixinlei.java.strings;

import org.springframework.util.StringUtils;

import java.util.Set;

public class StringDemo2 {

    public static void main(String[] args) {

//        Long.valueOf("");

        String s1 = ",,,";
        String s2 = "40532723,,,";

        String[] arr1 = StringUtils.commaDelimitedListToStringArray(s1);
        String[] arr2 = StringUtils.commaDelimitedListToStringArray(s2);

        System.out.println();
    }

    /**
     * 有问题的写法
     */
    private static void wrong() {
        String s1 = ",,,";
        String s2 = "40544184,,,\n";

        String[] s1Arr = s1.split(",");
        System.out.println(s1Arr.length); // 0
        System.out.println(s1Arr); // [Ljava.lang.String;@490d6c15
        System.out.println(s1Arr[0]); // java.lang.ArrayIndexOutOfBoundsException: 0
    }

}



